function  ChartOption(DataText,data){
 var	XMSMyChartOption = {
		tooltip: {
			trigger: 'item',
			formatter: '{a} <br/>{b}: {c} ({d}%)'
		},
		title: {
			text:DataText,
			top: '35%',
			left: '49%',
			textAlign: 'center',
			
			textStyle: {
				fontSize:24,
				color:"#fff",
				rich: {
					value: {
						color: '#08A7E9',
						fontSize: 26,
						lineHeight: 24,
					},
					name: {
						color: '#08A7E9',
						fontSize: 16,
						lineHeight: 35,
					},
				},
			},
		},
		legend: {
			textStyle: { //图例文字的样式
				color: '#FFFFFF',
				fontSize: 16
			}
		},
		series: [
			{
				name: '',
				type: 'pie',
				radius: ['50%', '70%'],
				avoidLabelOverlap: false,
				label: {
					show: false,
					position: 'inner',
				},
				emphasis: {
					label: {
						show: true,
						fontSize: '20'
					}
				},
				labelLine: {
					show: false
				},
				data:data,
				itemStyle:{
					normal: {
						color:function(params) {
							//自定义颜色
							var colorList = [
								'#45F0EA', '#0A8CFF', '#FFFF00', '#FF8C00', '#FF0000', '#FE8463',
							];
							return colorList[params.dataIndex]
						}
					}
				}
			}
		]
	}
    return  XMSMyChartOption;
}

var ZHXMdataSource = [];
var ZHXMDataAxis = ['总数', '节点', '投资数', '资金数'];
var ZHXMdata = [1, 1, 0, 1];
var ZHXMDataShadow = [];
for (var i = 0; i < ZHXMdata.length; i++) {
    ZHXMDataShadow.push(ZHXMdata[i]);
}






var   ZHId = "",JDId ="",TZId ="",ZJId ="";

function setOption(ZHCount,ZHProId,JDCount,JDProId,TZCount,TZProId,ZJCount,ZJProId) {
	
    return ZHXMOptions = {
        title: {
            // text: '特性示例：渐变色 阴影 点击缩放',
            // subtext: 'Feature Sample: Gradient Color, Shadow, Click Zoom'
        },
        grid: {
            top:'5%',
            left: '4%',
            right: '5%',
            bottom: '10%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            data: ['总数', '节点', '投资数', '资金数'],
            axisLabel: {
                inside:false,
                textStyle: {
                    color: '#fff',
                    fontSize:16,
                }
            },
            axisTick: {
                show: false
            },
            axisLine: {
                show: false
            },
            z: 10
        },
        yAxis: {
            splitLine: {
                show: true,
                lineStyle:{
                    color: '#244B8B',
                    width: 1,
                    type: 'solid',

                }
            },
            axisLine: {
                show: false,
            },
            axisTick: {
                show: false
            },
            axisLabel: {
                textStyle: {
                    color: '#fff',
                    fontSize:16,
                }
            }
        },
        dataZoom: [
            {
                type: 'inside'
            }
        ],
        series: [
            {
                type: 'bar',
                barWidth:25,
                itemStyle: {
                    color: function(params) {
                        var colorList = [
                            new echarts.graphic.LinearGradient(
                                0, 0, 0, 1,
                                [
                                    {offset: 0, color: '#3F28D0'},
                                    {offset: 1, color: '#0282DE'}
                                ]
                            ),
                            new echarts.graphic.LinearGradient(
                                0, 0, 0, 1,
                                [
                                    {offset: 0, color: '#FC9501'},
                                    {offset: 1, color: '#FED701'}
                                ]
                            ),
                            new echarts.graphic.LinearGradient(
                                0, 0, 0, 1,
                                [
                                    {offset: 0, color: '#0181DE'},
                                    {offset: 1, color: '#67E0E3'}
                                ]
                            ),
                            new echarts.graphic.LinearGradient(
                                0, 0, 0, 1,
                                [
                                    {offset: 0, color: '#FE411B'},
                                    {offset: 1, color: '#FE9B1A'}
                                ]
                            ),

                        ];

                        return colorList[params.dataIndex]

                    }
                },
                emphasis: {
                    itemStyle: {
                        color: new echarts.graphic.LinearGradient(
                            0, 0, 0, 1,
                            [
                                {offset: 0, color: '#2378f7'},
                                {offset: 0.7, color: '#2378f7'},
                                {offset: 1, color: '#83bff6'}
                            ]
                        )
                    }
                },
                data: [
					{value:ZHCount,proId:ZHProId},
					{value:JDCount,proId:JDProId},
					{value:TZCount,proId:TZProId},
					{value:ZJCount,proId:ZJProId}]
            }
        ]
    }
	
	
	
	
	
}




   //滞后项目

function setZHXMDom(dataSource,table,$JQuery) {
    //lagcount 总数
    var ZH = dataSource.lagcount;
    var ZHCount = ZH.count;
    var ZHProId = ZH.proids;
    // lagNode  节点
    var JD = dataSource.lagNode;
    var JDCount = JD.count;
    var JDProId = JD.proids;
    // lagInvert 投资
    var TZ = dataSource.lagInvert;
    var TZCount = TZ.count;
    var TZProId = TZ.proids;
    // lagMoney 资金
    var ZJ = dataSource.lagMoney;
    var ZJCount = ZJ.count;
    var ZJProId = ZJ.proids;
	
	
    var ZHXMMyChartDom = document.getElementById("ZHXMMyChartBox");
    var ZHXMMyChart = echarts.init(ZHXMMyChartDom);
    ZHXMMyChart.setOption(setOption(ZHCount,ZHProId,JDCount,JDProId,TZCount,TZProId,ZJCount,ZJProId))
	
    ZHXMMyChart.on('click',function (obj) {
    	var proIdList = obj.data.proId;
    	var url = '/search/prolist';
    	var dataParms = {"proIdList":proIdList}; 
    	httpAjax(url,dataParms,table);
    });
}

 //存在滞后风险项目
function setFXZHDom(dataSource,table,$) {
    //lagcount 总数
    var ZH = dataSource.riskcount;
    var ZHCount = ZH.count;
    var ZHProId = ZH.proids;
    // lagNode  节点
    var JD = dataSource.riskNode;
    var JDCount = JD.count;
    var JDProId = JD.proids;
    // lagInvert 投资
    var TZ = dataSource.riskInvert;
    var TZCount = TZ.count;
    var TZProId = TZ.proids;
    // lagMoney 资金
    var ZJ = dataSource.riskMoney;
    var ZJCount = ZJ.count;
    var ZJProId = ZJ.proids;
	
    var ZHFXXMMyChartDom = document.getElementById("ZHFXXMMyChartBox");
    var ZHFXXMMyChart = echarts.init(ZHFXXMMyChartDom);
	console.log(ZHCount,ZHProId,JDCount,JDProId,TZCount,TZProId,ZJCount,ZJProId)
    ZHFXXMMyChart.setOption(setOption(ZHCount,ZHProId,JDCount,JDProId,TZCount,TZProId,ZJCount,ZJProId));
    
	ZHFXXMMyChart.on('click',function (obj) {
		var proIdList = obj.data.proId;
		var url = '/search/prolist';
		var dataParms = {"proIdList":proIdList}; 
		httpAjax(url,dataParms,table);
	});
	
}



function initTable($,table,url,dataParms) {
    $.ajax({
        url: getIP() + url,
        async:false,
        type: 'post',
        contentType:'application/json',
        dataType:"json",
        data:JSON.stringify(dataParms),
        success: function (data) {
            if (data.code == "succee") {
				console.log(data)
                // dataSource = data.data[0];
                tableRender(table,data.data);
            }
        }
    });
}


function tableRender(table,data) {
//执行一个 table 实例
    table.render({
        elem: '#XMLBTable',
        height:250,
        data:data,
        even:true,
        // url: getIP() + '/search/prolist', //数据接口
        title: '项目列表',
        page:false, //开启分页
        totalRow: false, //开启合计行
        cols: [[ //表头
            // {field: 'proid', title: '序号', width:75,align:'center'},
            {field: 'procompanyname', title: '公司',align:'center', width:"30%"},
            {field: 'proname', title: '项目名称',align:'left',width:"70%"},
        ]]
    });
}


function  httpAjax(url,dataParms,table){
	var dataParms = dataParms?dataParms:{};
	var xmlHttp = new XMLHttpRequest();
		xmlHttp.open("post",getIP() + url);
		xmlHttp.setRequestHeader("Content-Type","application/json");// 设置请求头的Content-Type
		xmlHttp.send(JSON.stringify(dataParms));   // 请求体数据
		xmlHttp.onreadystatechange = function() {
			 if(xmlHttp.readyState == 4 ) {
				if(xmlHttp.status == 200 ) {
					var response = JSON.parse(xmlHttp.responseText) 
					if(response.code == "succee"){
						  tableRender(table,response.data);
						console.log(response.data)
					}
				}
	 
			}
		};
}
